package com.group9.handinhand.controller.form;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import com.group9.handinhand.service.so.CommunityMemberSO;
import com.group9.handinhand.service.so.OfferPostSO;
import com.group9.handinhand.service.so.OfferResponseSO;
import com.group9.handinhand.service.so.OfferSO;
import com.group9.handinhand.service.so.UserTagSO;

public class ResultViewForm {
	
//	OfferSO offer;
//	OfferSO moderatedOffer;
//	CommunityMemberSO communityMember;
//	String post;
//	int goodsAmount;
//	int servicesAmount;
//	int userContribution;
	ArrayList<Object> wallElements = new ArrayList<Object>();
	
//	List<UserTagSO> userTags;
//	ArrayList<Object> offerList;
	String keyword;
	String selection;
	int isEmptyResult;
	
	ArrayList<Object> searchList;
	/**
	 * A set method.
	 * Sets the elements on the offer wall to the offer.
	 */
	public void setWallElementsFromOffer(){
	//	wallElements.addAll(offer.getPosts());
		wallElements.addAll(searchList);
		Collections.sort(wallElements, new Comparator<Object>() {
			
			public int compare(Object o1, Object o2) {
				Date o1createDate = ((OfferPostSO)o1).getCreateDate();
						
				Date o2createDate = ((OfferPostSO)o2).getCreateDate();
				if (o1createDate == null || o2createDate == null)
					return 0;
				return o2createDate.compareTo(o1createDate);
			}
		});

	}
	


	public ArrayList<Object> getWallElements() {
		return wallElements;
	}



	public void setWallElements(ArrayList<Object> wallElements) {
		this.wallElements = wallElements;
	}



	public String getKeyword() {
		return keyword;
	}



	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}



	public ArrayList<Object> getSearchList() {
		return searchList;
	}



	public void setSearchList(ArrayList<Object> searchList) {
		this.searchList = searchList;
	}

	

	public String getSelection() {
		return selection;
	}



	public void setSelection(String selection) {
		this.selection = selection;
	}



	public int getIsEmptyResult() {
		return isEmptyResult;
	}



	public void setIsEmptyResult(int isEmptyResult) {
		this.isEmptyResult = isEmptyResult;
	}


	/**
	 * To string method which converts offer form in to a string.
	 */
	@Override
	public String toString() {
		return "OfferViewForm [wallElements=" + wallElements + "]";
	}

}
